package com.neouton.feginClient;

import com.alibaba.fastjson.JSONObject;
import com.neouton.common.util.ResponseAPI;
import com.neouton.crm.entity.SysUserEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(url = "${auth.server}", name = "auth")
public interface FeginService {

    /**
     * eg: 获取数据字典值，接口2后期替换为系统名
     *
     * @param keys
     * @return
     */
    @PostMapping("dataDictionary/queryDictionaryLookupInfo")
    JSONObject queryDictionaryLookupInfo(@RequestParam("moduleAbbr") String moduleAbbr, @RequestBody List<String> keys);

    /**
     * 根据用户idList获取用户信息
     *
     * @return
     */
    @PostMapping("sysUser/queryAllUsers")
    JSONObject getUserInfo(@RequestHeader("token") String token);

    /**
     * 根据uid获取用户信息
     * @param userId
     * @return
     */
    @PostMapping("/sysUser/queryUserById/{userId}")
    ResponseAPI<SysUserEntity> searchUserInfoById(@PathVariable("userId") Integer userId, @RequestHeader("token") String token);

    /**
     * 获取所有用户
     * @param token
     * @return
     */
    @PostMapping("/sysUser/queryAllUsers")
    ResponseAPI<List<SysUserEntity>> getUserIgnoreFlag(@RequestHeader("token") String token);

    /**
     * 获取所有用户
     * @return
     */
    @PostMapping("/sysUser/queryAllUsers")
    ResponseAPI<List<SysUserEntity>> getUserIgnoreFlag();

    /**
     * 根据uid获取用户信息
     * @param userId
     * @return
     */
    @PostMapping("/sysUser/queryUserById/{userId}")
    ResponseAPI<SysUserEntity> searchUserInfoByIds(@PathVariable("userId") Integer userId, @RequestHeader("token") String token);


    /**
     * 获取直接主管下所有员工（不包含自己）
     * @param userId
     * @return
     */
    @PostMapping("/sysUser/queryAllUsersByLeaderId/{leaderId}")
    ResponseAPI<List<SysUserEntity>> queryAllUsersByLeaderId(@PathVariable("leaderId") Integer userId, @RequestHeader("token") String token);

    /**
     * 获取用户领导的部门下的所有员工
     * @param userId
     * @return
     */
    @PostMapping("/sysUser/queryAllUsersByDeptLeaderId/{userId}")
    ResponseAPI<List<SysUserEntity>> queryAllUsersByDeptLeaderId(@PathVariable("userId") Integer userId, @RequestHeader("token") String token);

    /**
     * 递归获取直接主管下所有员工（不包含自己)
     * @param userId
     * @return
     */
    @PostMapping("/sysUser/recursiveQueryAllUserByLeaderId/{userId}")
    ResponseAPI<List<SysUserEntity>> recursiveQueryAllUserByLeaderId(@PathVariable("userId") Integer userId, @RequestHeader("token") String token);


    /**
     * 获取所有离职员工
     * @param token
     * @return
     */
    @PostMapping("/sysUser/queryAllInvalidUsers")
    ResponseAPI<List<SysUserEntity>> queryAllInvalidUsers(@RequestHeader("token") String token);

    /**
     * 获取全部有效用户信息
     * @return
     */
    @PostMapping("/sysUser/queryAllEffectiveUsers")
    ResponseAPI<List<SysUserEntity>> queryAllEffectiveUsers();


    @PostMapping("common/member/setCacheInfo")
    public ResponseAPI setCacheInfo (@RequestParam("cacheKey") String cacheKey, @RequestBody  Map<String,Object> map,@RequestHeader("token") String token);

    @PostMapping("common/member/getCacheInfo")
    public ResponseAPI getCacheInfo (@RequestParam("cacheKey") String cacheKey,@RequestParam("businessKey") String businessKey ,@RequestHeader("token") String token);

    @PostMapping("common/member/deleteCacheInfo")
    public ResponseAPI deleteCacheInfo (@RequestParam("cacheKey") String cacheKey,@RequestHeader("token") String token);

    @PostMapping("sysUser/getDeptLeaderByAccount")
    ResponseAPI<SysUserEntity> queryDeptByLeaderID(@RequestBody SysUserEntity sysUserEntity,@RequestHeader("token") String token);

}
